home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / pars.arc / PARS.ME < prev    next >
Text File  |  1987-12-03  |  2KB  |  40 lines

  1. This was written to separate slash-letter options from argv strings when
  2. they have been typed tight against the previous argument; e.g., the
  3. command line myprog name.x/p would treat "name.x/p" as the filename string.
  4.  
  5. The function is passed the usual argc and argv parameters and makes new
  6. ones, named uargc and uargv.  Define uargc and uargv as global in the
  7. calling module.
  8.  
  9. Quoted strings may use either double quote characters or single ones.
  10. Turbo C's initialize code processes the command line and separates
  11. double-quoted strings.  This program scans each argv to see if it contains
  12. a space; if so, double quotes are placed around it before re-extracting.
  13.  
  14. If the hyphen character begins an argv, it is changed to a slash.  A
  15. hyphen appearing within a string is left as is, since it could be part
  16. of a file name.
  17.  
  18. All letters, except for those within quoted strings, are converted to
  19. lower case.
  20.  
  21. The characters comma and semicolon are treated as argument separators.
  22.  
  23. uargv[0] is still the calling path\filename, just like the original argv[0].
  24.  
  25. The file demo.exe shows how it works.  Just type demo followed by a
  26. messy argument string, such as
  27.     demo FILE/A "12 34 aBc" /b /c/dir -k 89-0,1,2
  28.  
  29. The only problem I have found so far is when a double-quoted string
  30. contains a slash, but no space.  There is no indication that the
  31. original line had quotes, so the slash is assumed to be an option.
  32.  
  33. I am including the source (what there is of it) because you will no
  34. doubt want to customize it, and also because I do not
  35. accept responsibility for errors or maintenance.  If you have
  36. suggestions for improvement, or hints as to how I could have made this
  37. more elegant, leave a message for me on PC-Library BBS, (612) 435-3943.
  38.  
  39. 01-Dec-87                                        Bruce Nerase
  40.